package com.common;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class MenuFun {
	public static List<Map> getChild(List rows,String id){
		List<Map> menuTrees = new ArrayList<Map>();
		for(Object obj : rows){
			Map row = (Map) obj;
			if(!row.get("pid").toString().equals(id))continue;
			List<Map> childTrees = getChild(rows,row.get("id").toString());
			row.put("ChildNodes", childTrees);
			row.put("text", row.get("title"));
			row.put("value", row.get("id"));
			row.put("img", row.get("iconCls"));
			row.put("isexpand", true);
			row.put("hasChildren", childTrees.size()>0?true:false);
			row.put("parentnodes", row.get("pid"));
			menuTrees.add(row);
		}
		return menuTrees;
	}
}
